package com.zhaowei.allinpay.order;


import com.zhaowei.allinpay.DemoUtils;
import com.zhaowei.allinpay.IDemoHandler;
import org.json.JSONArray;
import org.json.JSONObject;

public class BatchAgentPaySimplifyHandler implements IDemoHandler {
    @Override
    public JSONObject getRequestParams() throws Exception {
        String bizOrderNo = System.currentTimeMillis() + "df2";

        JSONArray batchPayList = new JSONArray();

        JSONObject pay1 = new JSONObject();
        JSONArray collectPayList1 = new JSONArray();
        JSONObject collectPay11 = new JSONObject();
        collectPay11.put("bizOrderNo", "1474295042172ds");
        collectPay11.put("amount", 10);
        collectPayList1.put(collectPay11);
        JSONArray splitRuleList1 = new JSONArray();

        JSONObject splistRule1 = new JSONObject();
        splistRule1.put("bizUserId", "#yunBizUserId_application#");
        splistRule1.put("accountSetNo", "100002");
        splistRule1.put("amount", 2L);
        splistRule1.put("fee", 1L);

        splitRuleList1.put(splistRule1);

        JSONObject payToBankCardInfo1 = new JSONObject();
        String backUrl1 = "http://10.55.3.236:6003/test/recievePayBack.jsp";
        payToBankCardInfo1.put("bankCardNo", DemoUtils.rsaEncrypt("6228480000666022208"));
        payToBankCardInfo1.put("amount", 7);
        payToBankCardInfo1.put("backUrl", backUrl1);
        payToBankCardInfo1.put("bankCardPro", 0L);

        pay1.put("bizOrderNo", System.currentTimeMillis() + "df1");
        pay1.put("bizUserId", "yunDemo001");
        pay1.put("collectPayList", collectPayList1);
        pay1.put("accountSetNo", "200001");
        pay1.put("backUrl", "http://122.227.225.142:23661/test/recievePayBack.jsp");
        pay1.put("payToBankCardInfo", payToBankCardInfo1);
        pay1.put("amount", 10);
        pay1.put("fee", 1);
        pay1.put("splitRuleList", splitRuleList1);
        pay1.put("summary", "单笔代付1");
        pay1.put("extendInfo", "this is extendInfo");
        batchPayList.put(pay1);

        JSONObject pay2 = new JSONObject();
        JSONArray collectPayList2 = new JSONArray();
        JSONObject collectPay21 = new JSONObject();
        collectPay21.put("bizOrderNo", "1463584799426ds");
        collectPay21.put("amount", 1);
        collectPayList2.put(collectPay21);
        JSONArray splitRuleList2 = new JSONArray();

        JSONObject payToBankCardInfo2 = new JSONObject();
        String backUrl2 = "http://122.227.225.142:23661/test/recievePayBack.jsp";
        payToBankCardInfo2.put("bankCardNo", DemoUtils.rsaEncrypt("6228480000666022208"));
        payToBankCardInfo2.put("amount", 100);
        payToBankCardInfo2.put("backUrl", backUrl2);

        pay2.put("bizOrderNo", bizOrderNo);
        pay2.put("bizUserId", "yunDemo001");
        pay2.put("collectPayList", collectPayList2);
        pay2.put("accountSetNo", "200001");

        pay2.put("payToBankCardInfo", payToBankCardInfo2);
        pay2.put("amount", 1);
        pay2.put("fee", 0);
        pay2.put("splitRuleList", splitRuleList2);
        pay2.put("summary", "单笔代付2");
        pay2.put("extendInfo", "this is extendInfo");
        batchPayList.put(pay2);

        String bizBatchNo = System.currentTimeMillis() + "pldf";

        JSONObject param = new JSONObject();
        param.put("bizBatchNo", bizBatchNo);
        param.put("batchPayList", batchPayList);
        param.put("tradeCode", "2001");

        return param;
    }
}
